package com.my.chapter17;

import net.mindview.util.Countries;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;

public class practice7 {
    public static void main(String[] args) {
        ArrayList<String> al =
                new ArrayList<String>(Countries.names(10));
        LinkedList<String> ll =
                new LinkedList<String>(
                        Countries.names(20).subList(10, 20));
        for(Iterator<String> it = al.iterator(); it.hasNext();)
            System.out.print(it.next() + "; ");
        System.out.println("");
        System.out.println("********");
        for(Iterator<String> it = ll.iterator(); it.hasNext();)
            System.out.print(it.next() + "; ");
        System.out.println("");
        System.out.println("********");
        int alindex = 0;
        for(ListIterator<String> lit2 = ll.listIterator();
            lit2.hasNext();) {
            al.add(alindex, lit2.next());
            alindex += 2;
        }
        System.out.println("al = " + al);
    }
}
